package com.feng.gameproj;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity 
{
	private Button surfaceView = null;
	private Button canvasView = null;
	private Button shapeView = null;
	private Button fontView = null;
	private Button bitmapView = null;
	private Button shaderView = null;
	private Button screenInfo = null;
	
	private BtnListener btnListener = new BtnListener ();
	
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        this.surfaceView = (Button)findViewById (R.id.surfaceView);
        this.surfaceView.setOnClickListener(this.btnListener);
        
        this.canvasView = (Button)findViewById (R.id.canvasView);
        this.canvasView.setOnClickListener(this.btnListener);
        
        this.shapeView = (Button)findViewById (R.id.shapeView);
        this.shapeView.setOnClickListener(this.btnListener);
        
        this.fontView = (Button)findViewById (R.id.fontView);
        this.fontView.setOnClickListener(this.btnListener);
        
        this.bitmapView = (Button)findViewById (R.id.bitmapView);
        this.bitmapView.setOnClickListener(this.btnListener);
        
        this.shaderView = (Button)findViewById (R.id.shaderView);
        this.shaderView.setOnClickListener (this.btnListener);
        
        this.screenInfo = (Button)findViewById (R.id.screenInfo);
        this.screenInfo.setOnClickListener(this.btnListener);
    }
    
    class BtnListener implements OnClickListener 
    {
		@Override
		public void onClick(View v) 
		{
			Intent intent = new Intent ();
			switch (v.getId())
			{
				case R.id.surfaceView:
					intent.setClass(MainActivity.this, SurfaceActivity.class);
					startActivity (intent);
					break;
				case R.id.canvasView:
					intent.setClass(MainActivity.this, CanvasActivity.class);
					startActivity (intent);
					break;
				case R.id.shapeView:
					intent.setClass(MainActivity.this, ShapeActivity.class);
					startActivity (intent);
					break;
				case R.id.fontView:
					intent.setClass(MainActivity.this, FontActivity.class);
					startActivity (intent);
					break;
				case R.id.bitmapView:
					intent.setClass(MainActivity.this, BitmapActivity.class);
					startActivity (intent);
					break;
				case R.id.shaderView:
					intent.setClass(MainActivity.this, ShaderActivity.class);
					startActivity (intent);
					break;
				case R.id.screenInfo:
					intent.setClass(MainActivity.this, ScreenInfoActivity.class);
					startActivity (intent);
					break;
				default:
					break;
			}
		}
    }
    
}